/* Includes */
/* -------- */
#include "HALInputs.h"
#include "MALioapi.h"
#include "MALADC.h"


/**************************************************************
 *  Name                 :	Init_LightingSelector_hardware
 *  Description          :  Initialization for LightingSelector hardware
 *  Parameters           :  none
 *  Return               :	none
 *  Critical/explanation :  No
 **************************************************************/
void Init_LightingSelector_hardware				(void)
{
	IO_SetPinFctn(LightingSelector,PA_AM1);	//Port PB9 ANS[1] 
	ConfigPinAs_ADC_Channel(LightingSelector);
	Config_ADC_Mode(SCAN);
	JustifiedADCread(RIGHT);
	SetAmountOfChannels(0,1,0);
	SetConvertionTime(0,_32_MHz,0);	
	ADCStartConvertion();	//Send the request to get the LightingSelector value
}

/**************************************************************
 *  Name                 :	Init_AmbientLightSelector_hardware
 *  Description          :  Initialization for AmbientLightSelector hardware
 *  Parameters           :  none
 *  Return               :	none
 *  Critical/explanation :  No
 **************************************************************/
void Init_AmbientLightSelector_hardware			(void)
{
	IO_SetPinFctn(AmbientLightSelector,PA_AM1);	//Port PB10 ANS[2] 
	ConfigPinAs_ADC_Channel(AmbientLightSelector);
	Config_ADC_Mode(SCAN);
	JustifiedADCread(RIGHT);
	SetAmountOfChannels(0,1,0);
	SetConvertionTime(0,_32_MHz,0);	
	ADCStartConvertion();	//Send the request to get the AmbientLightSelector value
}

/**************************************************************
 *  Name                 :	Init_LeftTurnButton_hardware
 *  Description          :  Initialization for LeftTurnButton hardware
 *  Parameters           :  none
 *  Return               :	none
 *  Critical/explanation :  No
 **************************************************************/
void Init_LeftTurnButton_hardware				(void)
{
	IO_SetPinFctn(LeftTurnButton, PA_GPIO);
	IO_SetPinAsInput(LeftTurnButton);
}

/**************************************************************
 *  Name                 :	Init_RightTurnButton_hardware
 *  Description          :  Initialization for RightTurnButton hardware
 *  Parameters           :  none
 *  Return               :	none
 *  Critical/explanation :  No
 **************************************************************/
void Init_RightTurnButton_hardware				(void)
{
	IO_SetPinFctn(RightTurnButton, PA_GPIO);
	IO_SetPinAsInput(RightTurnButton);
}

/**************************************************************
 *  Name                 :	Init_SteeringWheel_hardware
 *  Description          :  Initialization for SteeringWheel hardware
 *  Parameters           :  none
 *  Return               :	none
 *  Critical/explanation :  No
 **************************************************************/
void Init_SteeringWheel_hardware				(void)
{
	IO_SetPinFctn(SteeringWheel,PA_AM1);	//Port PB8 ANS[0] 
	ConfigPinAs_ADC_Channel(SteeringWheel);
	Config_ADC_Mode(SCAN);
	JustifiedADCread(RIGHT);
	SetAmountOfChannels(0,1,0);
	SetConvertionTime(0,_32_MHz,0);	
	ADCStartConvertion();	//Send the request to get the SteeringWheel value
}

/**************************************************************
 *  Name                 :	Init_StopButton_hardware
 *  Description          :  Initialization for StopButton hardware
 *  Parameters           :  none
 *  Return               :	none
 *  Critical/explanation :  No
 **************************************************************/
void Init_StopButton_hardware					(void)
{
	IO_SetPinFctn(StopButton, PA_GPIO);
	IO_SetPinAsInput(StopButton);
}

/**************************************************************
 *  Name                 :	Init_EmergencyLightsButton_hardware
 *  Description          :  Initialization for EmergencyLightsButton hardware
 *  Parameters           :  none
 *  Return               :	none
 *  Critical/explanation :  No
 **************************************************************/
void Init_EmergencyLightsButton_hardware		(void)
{
	IO_SetPinFctn(EmergencyLightsButton, PA_GPIO);
	IO_SetPinAsInput(EmergencyLightsButton);
}

/**************************************************************
 *  Name                 :	Init_ReverseSwitch_hardware
 *  Description          :  Initialization for ReverseSwitch hardware
 *  Parameters           :  none
 *  Return               :	none
 *  Critical/explanation :  No
 **************************************************************/
void Init_ReverseSwitch_hardware				(void)
{
	IO_SetPinFctn(ReverseSwitch, PA_GPIO);
	IO_SetPinAsInput(ReverseSwitch);
}

/**************************************************************
 *  Name                 :	Init_IgnitionSwitch_hardware
 *  Description          :  Initialization for IgnitionSwitch hardware
 *  Parameters           :  none
 *  Return               :	none
 *  Critical/explanation :  No
 **************************************************************/
void Init_IgnitionSwitch_hardware				(void)
{
	IO_SetPinFctn(IgnitionSwitch, PA_GPIO);
	IO_SetPinAsInput(IgnitionSwitch);
}

/**************************************************************
 *  Name                 :	Init_HeadlightsBeamModeBtn_hardware
 *  Description          :  Initialization for HeadlightsBeamModeBtn hardware
 *  Parameters           :  none
 *  Return               :	none
 *  Critical/explanation :  No
 **************************************************************/
void Init_HeadlightsBeamModeBtn_hardware		(void)
{
	IO_SetPinFctn(HeadlightsBeamModeBtn, PA_GPIO);
	IO_SetPinAsInput(HeadlightsBeamModeBtn);
}

/**************************************************************
 *  Name                 :	Init_HeadlightsContinuousModeBtn_hardware
 *  Description          :  Initialization for HeadlightsContinuousModeBtn hardware
 *  Parameters           :  none
 *  Return               :	none
 *  Critical/explanation :  No
 **************************************************************/
void Init_HeadlightsContinuousModeBtn_hardware	(void)
{
	IO_SetPinFctn(HeadlightsContinuousModeBtn, PA_GPIO);
	IO_SetPinAsInput(HeadlightsContinuousModeBtn);
}

